package com.example.lib.utils.statusbar

import android.app.Activity
import android.content.Context
import androidx.fragment.app.Fragment
import com.gyf.immersionbar.ImmersionBar
import com.example.lib.R

/**
 * 状态栏工具类
 */
object StatusBarUtils {

    fun getStateBarHeight(context: Context): Int {
        return ImmersionBar.getStatusBarHeight(context)
    }

    fun getStateBarHeight(fragment: Fragment): Int {
        return ImmersionBar.getStatusBarHeight(fragment)
    }

    fun getNavigationBarHeight(context: Context): Int {
        return ImmersionBar.getNavigationBarHeight(context)
    }

    fun setStateAndNavigationBar(
        activity: Activity,
        stateBarDarkModel: Boolean = true,
        navigationBarDarkModel: Boolean = true,
        statusBarColor: Int = R.color.white,
        navigationBarColor: Int = R.color.white,
    ) {
        ImmersionBar.with(activity).statusBarDarkFont(stateBarDarkModel).navigationBarDarkIcon(navigationBarDarkModel)
            .transparentStatusBar().barEnable(true).statusBarColor(statusBarColor)
            .navigationBarColor(navigationBarColor).init()
    }
}